unit progress;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, ComCtrls, db, Gauges, GIFImage;

type
  TfrmProgress = class(TForm)
    StatusBar1: TStatusBar;
    Label1: TLabel;
    Gauge1: TGauge;
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Panel1: TPanel;
    Image4: TImage;
    Image5: TImage;
    Image6: TImage;
    Image7: TImage;
    Image8: TImage;
    Image9: TImage;
    Image10: TImage;
    Panel2: TPanel;
    Image11: TImage;
    Image12: TImage;
    Image13: TImage;
    Image15: TImage;
    Image16: TImage;
    Image17: TImage;
    Image14: TImage;
    Bevel1: TBevel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure Atualiza_barra;
    { Public declarations }
  end;

var
  frmProgress: TfrmProgress;

implementation

uses Principal;

{$R *.DFM}

{ TfrmProgress }


procedure TfrmProgress.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if formPrincipal.xcurrent < formPrincipal.xTotal then
  begin
    beep();
    abort;
  end;
  action := cafree;
end;

procedure TfrmProgress.Atualiza_barra;
begin

  if formPrincipal.xcurrent >= formPrincipal.xTotal then
  begin
    close;
    exit
  end;
//  ProgressBar1.Position := Trunc(frmPrincipal.xCurrent / (frmPrincipal.xTotal / 100));
  gauge1.Progress := Trunc(formPrincipal.xCurrent / (formPrincipal.xTotal / 100));
  application.ProcessMessages;
end;

procedure TfrmProgress.Button1Click(Sender: TObject);
begin
close;
end;

end.
